// 监听来自popup的消息
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
  if (request.action === 'getVideoLinks') {
    const videoElements = document.querySelectorAll('li.SmHs0qqX a.hY8lWHgA');
    const videos = [];

    videoElements.forEach(element => {
      const videoUrl = element.href;
      const title = element.querySelector('.ztA3qIFr')?.textContent || '';
      const likes = element.querySelector('.b3Dh2ia8')?.textContent || '0';
      
      videos.push({
        url: videoUrl,
        title: title,
        likes: likes
      });
    });

    sendResponse({ videos: videos });
  }
  return true;
}); 